package com.classes;

import java.nio.ByteBuffer;

public class Magic {

    /**
     * 魔数
     *
     * @param buffer
     * @return
     */
    public static String magic(ByteBuffer buffer) {
        StringBuilder sb = new StringBuilder("魔数：");
        sb.append(Integer.toHexString(Byte.toUnsignedInt(buffer.get())) + " ");
        sb.append(Integer.toHexString(Byte.toUnsignedInt(buffer.get())) + " ");
        sb.append(Integer.toHexString(Byte.toUnsignedInt(buffer.get())) + " ");
        sb.append(Integer.toHexString(Byte.toUnsignedInt(buffer.get())) + "");
        return sb.toString().toUpperCase();
    }


}
